package com.yuanfeng.job.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yuanfeng.commoms.util.ParseMapUtils;
import com.yuanfeng.job.entity.JobMoneyStaticsEntity;
import com.yuanfeng.job.mapper.JobMoneyStaticsMapper;
import com.yuanfeng.job.service.JobMoneyStaticsService;
import org.springframework.stereotype.Service;

import java.math.BigDecimal;
import java.util.Map;

/**
 *
 */
@Service
public class JobMoneyStaticsServiceImpl extends ServiceImpl<JobMoneyStaticsMapper, JobMoneyStaticsEntity>
    implements JobMoneyStaticsService {

    @Override
    public void InsertMoneyStatistport(String mapHash) {
        Map<String,Object> result = this.baseMapper.queryMoneyStatist();
        //已充值金额
        BigDecimal rechargedAmount = this.baseMapper.getRechargedAmount();
        //激活未充值金额
        BigDecimal unrechargeAmount = this.baseMapper.getUnrechargedAmount();

        JobMoneyStaticsEntity entity= ParseMapUtils.parseMap2Object(result,JobMoneyStaticsEntity.class);

        entity.setRechargedAmount(rechargedAmount);
        entity.setUnrechargeAmount(unrechargeAmount);
        entity.setCreateTime(mapHash);
        this.baseMapper.insert(entity);
    }
}




